--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  E:\Seagate Sync\VOL\Personal folder\Documents\Research\Past project
> s\cbld\Posted\121020 Website\Data analysis\cbld-management01.log
  log type:  text
 opened on:  21 Oct 2012, 15:40:39

. 
. 
. * ****************************************************************************
. * Processing of results of computational experiments for further data analysis
. * ****************************************************************************
. 
. * Programme:    cbld-management01.do
. * Project:              Council coalition building
. * Author:               Frank Haege, Department of Politics and Administration
> , University of Limerick
. * Contact:              frank.haege@ul.ie
. 
. * Description
. *************
. * This do-file imports the data generated by the computational experiments,
. * constructs some additional variablesand, and generates cross-sectional data 
> sets
. * by collapsing time-steps within simulation runs
. 
. 
. * Set up Stata
. version 11

. clear all

. macro drop _all

. set linesize 80

. set more off

. 
. 
. * Process the results of each computational experiment
. ******************************************************
. 
. * Loop through each set of experimental results
. foreach i in 1 2 3 {
  2. 
.         * Load data set generated by computational experiment
.         insheet using "Experiments\Experiment0`i'\cbld-model-121020-exp0`i'.cs
> v", clear
  3.         sort runnumber step
  4.         
.         * Drop redundant variables
.         drop numberofmemberstates sequenceofmoves regimeparameters
  5.         
.         * Order variables
.         order runnumber step randomseed numsequenceofmoves numregimeparameters
>  countturtles
  6.         
.         * Rename variables
.         rename runnumber runno
  7.         rename randomseed rseed
  8.         rename numsequenceofmoves sequence
  9.         rename numregimeparameters regime
 10.         rename countturtles nostates
 11.         rename votingthreshold vthresh
 12.         rename firstcriteriontotal firsttotal
 13.         rename firstwinningthreshold firstwin
 14.         rename firstblockingthreshold firstblock
 15.         rename secondcriteriontotal secondtotal
 16.         rename secondwinningthreshold secondwin
 17.         rename secondblockingthreshold secondblock
 18.         rename thirdcriteriontotal thirdtotal
 19.         rename thirdwinningthreshold thirdwin
 20.         rename thirdblockingthreshold thirdblock
 21.         rename countblockingmemberstates noblock
 22.         rename countpatcheswithcountturtleshere nocoal
 23.         rename maxmyfirstcriterionsizeofturtles firstmax
 24.         rename minmyfirstcriterionsizeofturtles firstmin
 25.         rename maxmysecondcriterionsizeofturtle secondmax
 26.         rename minmysecondcriterionsizeofturtle secondmin
 27.         rename maxmythirdcriterionsizeofturtle thirdmax
 28.         rename minmythirdcriterionsizeofturtle thirdmin
 29.         rename precisionmeanlistofdistances1 meandist
 30.         rename precisionmedianlistofdistances1 meddist
 31.         rename precisionminlistofdistances1 mindist
 32.         rename precisionmaxlistofdistances1 maxdist
 33.         
.         * Collapse results along time dimension
.         sort runno step
 34.         collapse (first) rseed=rseed sequence=sequence regime=regime nostat
> es=nostates vthresh=vthresh /*
>                 */ firsttotal=firsttotal firstwin=firstwin firstblock=firstblo
> ck /*
>                 */ secondtotal=secondtotal secondwin=secondwin secondblock=sec
> ondblock /*
>                 */ thirdtotal=thirdtotal thirdwin=thirdwin thirdblock=thirdblo
> ck /*
>                 */ (last) noblock=noblock nocoal=nocoal step=step/*
>                 */ firstmax=firstmax firstmin=firstmin secondmax=secondmax sec
> ondmin=secondmin thirdmax=thirdmax thirdmin=thirdmin /*
>                 */ (first) meandist=meandist meddist=meddist /*
>                 */ mindist=mindist maxdist=maxdist, by(runno)
 35.         
.         * Label variables
.         label var runno "Run number"
 36.         label var rseed "Random seed"
 37.         label var sequence "Order of agent execution"
 38.         label var regime "Regime parameters"
 39.         label var nostates "Number of member states"
 40.         label var firsttotal "Total number of votes (first criterion)"
 41.         label var vthresh "Voting threshold"
 42.         label var firstwin "Winning coalition size (first criterion)"
 43.         label var firstblock "Blocking coalition size (first criterion)"
 44.         label var secondtotal "Total number of votes (second criterion)"
 45.         label var secondwin "Winning coalition size (second criterion)"
 46.         label var secondblock "Blocking coalition size (second criterion)" 
>      
 47.         label var thirdtotal "Total number of votes (third criterion)"
 48.         label var thirdwin "Winning coalition size (third criterion)"
 49.         label var thirdblock "Blocking coalition size (third criterion)"   
>      
 50.         label var step "Time periods"
 51.         label var noblock "Number of states in blocking coalitions"
 52.         label var nocoal "Number of coalitions"
 53.         label var firstmax "Size of largest coalition (first criterion)"
 54.         label var firstmin "Size of smallest coalition (second criterion)"
 55.         label var secondmax "Size of largest coalition (second criterion)"
 56.         label var secondmin "Size of smallest coalition (second criterion)"
 57.         label var thirdmax "Size of largest coalition (third criterion)"
 58.         label var thirdmin "Size of smallest coalition (third criterion)"
 59.         label var meandist "Mean distance between positions"
 60.         label var meddist "Median distance between positions"
 61.         label var mindist "Minimum distance between positions"
 62.         label var maxdist "Maximum distance between positions"
 63.         
.         * Save as Stata data set
.         sort runno
 64.         compress
 65.         save "Experiments\Experiment0`i'\cbld-model-121020-exp0`i'.dta", re
> place
 66. }
(31 vars, 271812 obs)
file Experiments\Experiment01\cbld-model-121020-exp01.dta saved
(31 vars, 140040 obs)
file Experiments\Experiment02\cbld-model-121020-exp02.dta saved
(31 vars, 160856 obs)
file Experiments\Experiment03\cbld-model-121020-exp03.dta saved

. 
. 
. * Exit do-file
. log close
      name:  <unnamed>
       log:  E:\Seagate Sync\VOL\Personal folder\Documents\Research\Past project
> s\cbld\Posted\121020 Website\Data analysis\cbld-management01.log
  log type:  text
 closed on:  21 Oct 2012, 15:41:07
--------------------------------------------------------------------------------
